//
//  FFImgPickerC.m
//  beichoo_N_ios
//
//  Created by fanfan on 2017/9/4.
//  Copyright © 2017年 陈健. All rights reserved.
//

#import "FFImgPickerC.h"

@interface FFImgPickerC ()<TZImagePickerControllerDelegate>

@end

@implementation FFImgPickerC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma - tzImgPickerC -第三方 照片选择器
- (TZImagePickerController *)tzImgPickerC{
    if (!_tzImgPickerC) {
        _tzImgPickerC = [[TZImagePickerController alloc] initWithMaxImagesCount:1
                                                                   columnNumber:4
                                                                       delegate:self
                                                              pushPhotoPickerVc:NO];
        // 隐藏不可以选中的图片，默认是NO，不推荐将其设置为YES
        _tzImgPickerC.hideWhenCanNotSelect = YES;
        // 隐藏不可以选中的图片，默认是NO，不推荐将其设置为YES
        _tzImgPickerC.hideWhenCanNotSelect = YES;
        //        _tzImgPickerC.photoWidth = [UIScreen mainScreen].bounds.size.width*2;
        // _tzImgPickerC.photoPreviewMaxWidth = [UIScreen mainScreen].bounds.size.width;
        _tzImgPickerC.allowPickingVideo = NO;
        _tzImgPickerC.allowPickingGif = NO;
        _tzImgPickerC.allowCrop = YES;
        _tzImgPickerC.cropRect = CGRectMake(0, [UIScreen mainScreen].bounds.size.height/2-[UIScreen mainScreen].bounds.size.width*3/4/2, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*3/4);
        _tzImgPickerC.barItemTextColor = [UIColor blackColor];
        _tzImgPickerC.naviBgColor = [UIColor whiteColor];
    }
    return _tzImgPickerC;
}
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto
{
    
}
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos
{
    
}
//- (void)imagePickerControllerDidCancel:(TZImagePickerController *)picker __attribute__((deprecated("Use -tz_imagePickerControllerDidCancel:.")));
- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker
{
    
}

// If user picking a video, this callback will be called.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
// 如果用户选择了一个视频，下面的handle会被执行
// 如果系统版本大于iOS8，asset是PHAsset类的对象，否则是ALAsset类的对象
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset
{
    
}

// If user picking a gif image, this callback will be called.
// 如果用户选择了一个gif图片，下面的handle会被执行
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(id)asset
{
    
}

// Decide album show or not't
// 决定相册显示与否 albumName:相册名字 result:相册原始数据
- (BOOL)isAlbumCanSelect:(NSString *)albumName result:(id)result
{
    return YES;
}

// Decide asset show or not't
// 决定照片显示与否
- (BOOL)isAssetCanSelect:(id)asset
{
        return YES;
}

@end
